<form class="layui-form" action="">
    <input name="eConfigId" id="eConfigId1" type="hidden" />

    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">选择配置:</label>
            <div class="layui-input-inline">
                <input type="text" name="eConfigName" id="eConfigName1" lay-filter="tree" placeholder="请选择配置"  autocomplete="off" class="layui-input">
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">选择表:</label>
            <div class="layui-input-inline">
                <input type="text" name="eTabName" id="eTabName2" lay-filter="tree" placeholder="请选择要同步的表"  autocomplete="off" class="layui-input">
            </div>
        </div>
    </div>


</form>

<script type="text/javascript">

    $(document.body).on('click', '#eConfigName1', function () {
        // 获取配置列表
        layui.use('layer', function() {
            var $ = layui.jquery, layer = layui.layer;

            var layId = layer.open({
                title:'请选择配置',
                id: 'LAY_configTree',//设定一个id，防止重复弹出
                type: 1,
                area: ['300px', '400px'],
                shadeClose: true,
                closeBtn: 0,
                content: getHtml('/sys/config/tree.html')
            });

            $('#tempSyncLayId').attr('layId',layId);
        });
    });

    $(document.body).on('click', '#eTabName2', function () {
        let cid = $('#eConfigId1').val();
        if (cid == null || cid == ''){
            layer.alert('请先选择配置');
        }else {
            layui.use('layer', function() {
                var $ = layui.jquery, layer = layui.layer;

                layer.open({
                    title:'选择要同步的表',
                    id: 'LAY_tabCheckTree',//设定一个id，防止重复弹出
                    type: 1,
                    area: ['300px', '400px'],
                    shadeClose: true,
                    closeBtn: 0,
                    btn: ['确定','取消'],
                    content: getHtml('/sys/check/tree.html'),
                    yes: function(index){
                        layui.use('tree', function() {
                            var tree = layui.tree
                            var checkedData = tree.getChecked('syncCheckTabId'); //获取选中节点的数据
                            let tables = getCheckedTables(checkedData);
                            document.getElementById("eTabName2").value= tables;

                        })

                        layer.close(index);
                    },
                    btn2: function(index){
                        layer.close(index);
                    }
                });

            });

        }

    });




</script>